import { Empty } from 'antd'
export const useFormBase = ({
  detailInfo,
  classBig,
  DICTDATA,
  SupplierOption,
  handleSearchSupplier,
}: {
  detailInfo: Record<string, any>
  classBig: IOptionItem[]
  DICTDATA: IDICTDATAType
  SupplierOption: IOptionItem[]
  handleSearchSupplier: (newValue: string) => void
}): IItemArray[] => {
  return [
    {
      name: 'fabricCode',
      label: '面料编码',
      type: 'Custom',
      slot: detailInfo?.fabricCode || '-',
    },
    {
      name: 'devSeason',
      label: '开发季',
      type: 'Custom',
      slot: detailInfo?.devSeason || '-',
    },
    {
      name: 'fabricTypeCode',
      label: '关联面种编码',
      type: 'Custom',
      slot: detailInfo?.fabricTypeCode || '-',
    },
    {
      name: 'fabricName',
      label: '面料名称',
      type: 'Input',
      placeholder: '请输入面料名称',
      rules: [
        {
          required: true,
          message: '请输入面料名称',
        },
      ],
    },
    {
      name: 'classIds',
      label: '可用大类',
      type: 'Select',
      option: classBig,
      placeholder: '请选择可用大类',
      config: {
        mode: 'multiple',
        maxTagCount: 'responsive',
      },
      rules: [
        {
          required: true,
          message: '请选择可用大类',
        },
      ],
    },
    {
      name: 'seasonClassify',
      label: '面料季节',
      type: 'Select',
      option: DICTDATA.season_classify,
      placeholder: '请选择面料季节',
      config: {
        showSearch: true,
        optionFilterProp: 'label',
      },
      rules: [
        {
          required: true,
          message: '请选择面料季节',
        },
      ],
    },
    {
      name: 'devLocation',
      label: '面料定位',
      type: 'Select',
      option: DICTDATA.dev_location,
      placeholder: '请选择面料定位',
      config: {
        optionFilterProp: 'label',
      },
      rules: [
        {
          required: true,
          message: '请输入面料定位',
        },
      ],
    },
    {
      name: 'priceTag',
      label: '面料价格带',
      type: 'Select',
      option: DICTDATA.price_band,
      placeholder: '请选择面料价格带',
      config: {
        optionFilterProp: 'label',
      },
      rules: [
        {
          required: true,
          message: '请输入面料价格带',
        },
      ],
    },
    {
      name: 'intensiveStatus',
      label: '是否集约',
      type: 'Select',
      option: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
      rules: [
        {
          required: true,
          message: '请选择是否集约',
        },
      ],
    },
    {
      name: 'supplierIds',
      label: '供应商',
      type: 'Select',
      option: SupplierOption,
      config: {
        suffixIcon: null,
        showSearch: true,
        optionFilterProp: 'label',
        filterOption: false,
        mode: 'multiple',
        maxTagCount: 'responsive',
        onSearch: handleSearchSupplier,
        notFoundContent: <Empty description="请输入内容搜索" image={Empty.PRESENTED_IMAGE_SIMPLE} />,
      },
      rules: [
        {
          required: true,
          message: '请选择供应商',
        },
      ],
    },
    {
      name: 'cost',
      label: '面料成本',
      type: 'Input',
      placeholder: '请选择面料成本',
      rules: [
        {
          required: true,
          message: '请输入面料成本',
        },
      ],
    },
    {
      name: 'remark',
      label: '面料备注',
      type: 'TextArea',
      placeholder: '请输入面料备注',
      config: {
        showCount: true,
        maxLength: 100,
      },
    },
  ]
}
